package com.bruce.demo2.patterns.demo3.behavioral.demo15.command;

/**
 * @PROJECT_NAME: design_patterns
 * @DESCRIPTION: 测试类
 * @AUTHOR: CNBruceLee
 * @DATE: 2021/8/31 21:16
 */
public class Test {
    @org.junit.Test
    public void test() {

        //创建第1个订单类
        Order order1 = new Order();
        order1.setDiningTable(1);
        order1.setFood("西红柿鸡蛋面", 1);
        order1.setFood("小杯可乐", 2);

        //创建第2个订单类
        Order order2 = new Order();
        order2.setDiningTable(2);
        order2.setFood("尖椒肉丝盖饭", 1);
        order2.setFood("小杯雪碧", 1);

        //创建厨师对象
        SeniorChef receiver = new SeniorChef();

        //创建命令对象
        OrderCommand cmd1 = new OrderCommand(receiver, order1);
        OrderCommand cmd2 = new OrderCommand(receiver, order2);

        //创建调用者（服务员对象）
        Waitor invoke = new Waitor();
        invoke.setCommand(cmd1);
        invoke.setCommand(cmd2);

        //让服务员发起命令
        invoke.orderUp();
    }
}
